<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta content="email=no" name="format-detection">
<meta content="telephone=no" name="format-detection">
<title>用水申请</title>
<link rel="stylesheet" type="text/css" href="../../css/common.css">
<link rel="stylesheet" type="text/css" href="../../css/business.css">
<link rel="stylesheet" type="text/css" href="../../css/personal.css">
<link rel="stylesheet" type="text/css" href="../../css/serial.css">

<link rel="stylesheet" type="text/css"
	href="../../font-awesome-4.5.0/css/font-awesome.min.css">
<script src="../asset/js/jquery-2.2.1.min.js"></script>
	<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script src="../asset/js/baseinfo.js"></script>
<script src="../../js/user/business.js"></script>
</head>
<body>
	<!-- 主页面main开始 -->
	<form action="" id="busiForm">
		<input type="hidden" name="applyType" value="01" id="applyType">
		<input type="hidden" name="userNo" value="" id="userNo">
		
		<div class="main">
			<div class="return">
				<!-- <a href="index.html"><span class="fa fa-angle-left" id="left"></span>
				</a> -->
			</div>
			<div class="wrap">
				<div class="header">
					<div class="title">
						<p class="bs-type">业务类型</p>
						<p class="new-user">新户报装</p>
					</div>
					<div class="next">
						<a href="JavaScript:void(0);"><span class="fa fa-angle-right" id="right"></span>
						</a>
					</div>
				</div>
				<!-- 新户报装模块开始 -->
				<div class="decorate">
					<div class="content">
						<div class="info">
							<div class="user-name">
								<p>姓名</p>
								<input type="text" name="applyDetail.userName" placeholder="输入姓名" id="name" />
							</div>
							<div class="tel">
								<p>手机号码</p>
								<input type="text" name="applyDetail.mobile" placeholder="输入手机号码" id="phone" />
							</div>
							<div class="cer">
								<p>身份证号码</p>
								<input  type="text" name="applyDetail.idNo" placeholder="输入身份证号码"
									id="identity" />
							</div>
							<div class="tel">
								<p>现居住址</p>
								<input  type="text" name="applyDetail.userAddress" placeholder="输入现居地址"
									id="userAddress" />
							</div>
						</div>
					</div>
					<div class="upload-main">
						<div class="upload">
							<div class="img">
								<img src="../../images/icon_photo.png" />
							</div>
							<!-- <div class="zhushi"  >点击上传身份证照片<input type="file" name="uploadFile" ></div> -->
							<div class="zhushi" >点击上传身份证照片</div>
						</div>
						<div class="sel-img" id="chooseImage">
							<div class="pic pic01" id="previewImage" onclick="loadImg(this, 'previewImage');"></div>
							<div class="pic pic02" id="downloadImage" onclick="loadImg(this, 'downloadImage');"></div>
							<div style="clear: both;"></div>
						</div>
					</div>
					<p class="tips">*请点击图片区域添加或修改图片</p>
				</div>
				<!-- 新户报装模块结束 -->
				<!-- 故障报修模块开始 -->
				<div class="repair">
					<div class="resource-house">
						<div class="house">
							<p>房源</p>
							<div class="res-sl">
									<label id="hsname"></label><a href="javascript:void(0)" onclick="selectHs()"><span class="fa fa-angle-right"></span>
								</div> </a>
						</div>
						<div class="hou-tel">
							<p>手机号码</p>
							<input type="text" placeholder="输入手机号码" id="phoneNumber" />
						</div>
					</div>
				</div>
				<!-- 故障报修模块结束 -->
				<button type="button" value="提 交" class="confirm"
					onclick="submitApplyInfo(this);">提 交</button>
			</div>
		</div>
	</form>
	<!-- 主页面main结束 -->
	<!-- 业务类型模块开始 -->
	<div class="business-main">
		<div class="business">
			<div class="business-ch">
				<p class="type" applyType="01">用户新装</p>
				<p class="state">已选择</p>
			</div>
			<div class="business-ch">
				<p class="type" applyType="02">故障报修</p>
				<p class="state"></p>
			</div>
			<div class="business-ch">
				<p class="type" applyType="03">水表检测</p>
				<p class="state"></p>
			</div>
			<div class="business-ch business-ch00">
				<p class="type" applyType="04">用户销户</p>
				<p class="state"></p>
			</div>
		</div>
	</div>
	<div class="serial-main">
		<div class="serial" id="hsList">
		</div>
	</div>
	<!-- 业务类型模块结束 -->
		<div class="serial-ch" id="hsInfosTemplate" style="display: none;">
		<a href="javascript:void(0)" onclick="userThisHs(this)">
			<p class="building" var=""></p>
			<p class="state"></p>
		</a>
	</div>
		<script src="../asset/js/idNocheck.js"></script>
		<script src="../asset/js/jquery-2.2.1.min.js"></script>
		<script src="../../js/user/business.js"></script>
		<script type="text/javascript">
			var images = {
				previewImage: '',
				downloadImage: ''
			  };
			$(function() {
				$('.deal-main .deal-list .de-tp').bind('click',
						function(event) {
							//$('.deal-main').hide();
							//$('.main').show();
							window.location.reload();
						});
			});
			
			var divDocument;
			var divName;
			var imgload;
			
			function loadImg(objData, objName){
				divDocument = objData;
				divName = objName;
				
				/* while(divDocument.hasChildNodes()){ //当div下还存在子节点时 循环继续
		    		divDocument.removeChild(divDocument.firstChild);
		        }
			    var img = document.createElement("img");
			    img.setAttribute("class", "pic pic01");
				//img.src = imgload;
				img.src = "/web/images/icon_application.png";

			    divDocument.appendChild(img);
            	
            	if(divName == 'previewImage'){
					//images.previewImage = res.serverId;
            		images.previewImage = "gsdfgeesgd";
				}
				if(divName == 'downloadImage'){
					//images.downloadImage = res.serverId;
					images.downloadImage = "123erwer";
				} */
				
				
			 	wx.chooseImage({
					count: 1, // 默认9
				    sizeType: ['compressed'], // 可以指定是原图还是压缩图，默认二者都有
				    sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
				    success: function (res) {
				    	imgload = res.localIds[0];
				    	upload();// 返回选定照片的本地ID列表，localId可以作为img标签的src属性显示图片
				    	function upload(){
					    	wx.uploadImage({
					            localId: imgload,
					            success: function (res) {
					            	while(divDocument.hasChildNodes()){ //当div下还存在子节点时 循环继续
							    		divDocument.removeChild(divDocument.firstChild);
							        }
								    var img = document.createElement("img");
							        img.setAttribute("class", "pic pic01");
									img.src = imgload;

							        divDocument.appendChild(img);
					            	
					            	if(divName == 'previewImage'){
										images.previewImage = res.serverId;
									}
									if(divName == 'downloadImage'){
										images.downloadImage = res.serverId;
									}
					            },
					            fail: function (res) {
					            }
					         });
				    	}
				    }
				});
			}
		</script>
</body>
</html>